// We require the Hardhat Runtime Environment explicitly here. This is optional
// but useful for running the script in a standalone fashion through `node <script>`.
//
// When running the script with `npx hardhat run <script>` you'll find the Hardhat
// Runtime Environment's members available in the global scope.
const hre = require("hardhat");

async function main() {
  // Hardhat always runs the compile task when running scripts with its command
  // line interface.
  //
  // If this script is run directly using `node` you may want to call compile
  // manually to make sure everything is compiled
  // await hre.run('compile');

  // Greeter合约部署
  // const Greeter = await hre.ethers.getContractFactory("Greeter");
  // const greeter = await Greeter.deploy("Hello, Hardhat!");
  // await greeter.deployed();
  // console.log("Greeter deployed to:", greeter.address);


  // 发行货币合约
  const MyFirstToken = await hre.ethers.getContractFactory("Token");
  // 构造合约
  const myFirstToken = await MyFirstToken.deploy();
  // 部署合约
  await myFirstToken.deployed();
  // console.info("My first token has deployed!");
  console.log("MyFirstToken deployed to:", myFirstToken.address);

  // // 投票合约
  // const Vote = await hre.ethers.getContractFactory("Vote");
  // const vote = await Vote.deploy(1646694221);
  // await vote.deployed();
  // console.log("vote deployed to:", vote.address);

  // // 客户管理合约
  // const CustomerManager = await hre.ethers.getContractFactory("CustomerManager");
  // const customerManager = await CustomerManager.deploy();
  // await customerManager.deployed();
  // console.log("Customer deployed to: ", await customerManager.address);

  // // 零钱分账器合约
  // const ChangerMachine = await hre.ethers.getContractFactory("ChangerMachine");
  // // 初始化传入usdt地址，[预留出金地址, 平台账户地址]，[预留出金分成比例，平台账户分成比例]
  // const changerMachine = await ChangerMachine.deploy("0xa696d4afe3e6b3b1ab1fabda959034c96747041e", ["0x2D90A171c62A0D2033d3aED05a1DF2AEd2815E5b","0x256EAc5e66d8B84e27461366C32fd2f4b4fF76e7"], ["20","40"]);
  // await changerMachine.deployed();
  // console.log("changerMachine deployed to: ", changerMachine.address);

  // nft合约
  const NFTAsset = await hre.ethers.getContractFactory("NFTAsset");
  const nftAsset = await NFTAsset.deploy();
  await nftAsset.deployed();
  console.log("NFTAsset deployed to: ", nftAsset.address);

    // NFTCastSplit 合约部署
    const baseUrl = "https://nft.forsixcc.com/"; // 默认配置地址
    const NFT = await hre.ethers.getContractFactory("NFTCastSplit");
    // 代币
    nft = await NFT.deploy("ForsixccNFT","FRX", baseUrl, myFirstToken.address, 100000000000000000000, beneficiaries, percentages);
    await nft.deployed();
    console.log("FractallerSplitNFT deployed to:", nft.address);
    MINTER_ROLE = await nft.MINTER_ROLE();
    console.log("FractallerSplitNFT MINTER_ROLE Hash:", MINTER_ROLE);
}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error);
    process.exit(1);
  });
